
class Model {
    constructor() {
        
    }

    // 解析json到属性
    deserialize(params: any) {
        
        if (typeof params == "string") {
            this.deserialize(JSON.parse(params))
        } else {
            for (const key in params) {
                if (Object.prototype.hasOwnProperty.call(this, key)) {
                    if (this[key] instanceof Model) {
                        this[key].deserialize(params[key])
                    } else {
                        this[key] = params[key]
                    }
                }
            }
        }
    }
}

export default Model